<template>
	<view class="content">
		<view class="tab_list">
			<text v-for="(item,index) in tab_list" :key="index" @click="changeTab(index)" :class="{'active':item.isActive}">{{item.title}}</text>
			
		</view>
		<view class="brand_list" v-if="recruitmentTeam.length">
			
				<view class="occupancy_list_item"  v-for="(item,index) in recruitmentTeam" :key="index">
					<image src="../../static/img/gq.png" mode="" style="width: 168rpx;height:168rpx;"></image>
					<view class="occupancy_rt">
						<view class="occupancy_rt_title">
							<text>{{item.mechanismTitle}}</text>
							
						</view>
						<view class="search_label">
							<view class="search_label_lf">
								<view>招生总场次：{{item.mechanismRecruitment}}场</view>
								<view>收费标准：{{item.mechanismCharge}}元</view>
							</view>
							<view class="consulting" @click="callPhone(item)">
								咨询
							</view>
						</view>
						
						<view class="occupancy_browse">
							<view>
								{{item.mechanismAddress}}
							</view>
							
							
						</view>
						
					</view>
				
			</view>
			
		</view>
		<template v-else >
			<view class="noData">
				<view class="noDataImg">
					<image src="../../static/img/noData.png" mode="" style="width: 298rpx;height: 339rpx;"></image>
				</view>
				<view class="noDataTitle">
					<view>暂无课程</view>
					<view>还没找到相关的课程哦</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				tab_list:[{
					title:"推荐",
					isActive:true
				},{
					title:"最新",
					isActive:false
				}],
				index:0,
				recruitmentTeam:[],//列表数据
				cityCode:'110101'
			}
		},
		onShow() {
			this.recruitmentTeamFun(this.index)
		},
		methods:{
			callPhone(item){
				uni.makePhoneCall({
				 	
				 // 手机号
				    phoneNumber:item.phoneNumber, 
				// 成功回调
				success: (res) => {
				console.log('调用成功!')	
				},
				// 失败回调
				fail: (res) => {
				console.log('调用失败!')
				},
				})
			},
			changeTab(index){
				this.index=index
				this.tab_list.forEach((a,i)=>{
					a.isActive=false;
					if(index==i){
						a.isActive=true;
					}
				})
				this.recruitmentTeamFun(this.index)
			},
			recruitmentTeamFun(type){
				this.$http.get('/api/dream/recruitmentTeam/'+type+'/'+this.cityCode).then((data)=>{
					if(data.data.code==200){
						if(data.data.result){
							this.recruitmentTeam=data.data.result.records||[]
						}
						
					}
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	@import '@/static/css/brandInvestment.scss'
</style>
